#include <iostream>
#include "kernel.h"

__global__ void cudaKernel(int* num) {
    *num *= 2;
}

void cudaFunction(int& num) {
    int* d_num;
    cudaMalloc((void**)&d_num, sizeof(int));
    cudaMemcpy(d_num, &num, sizeof(int), cudaMemcpyHostToDevice);
    cudaKernel<<<1, 1>>>(d_num);
    cudaMemcpy(&num, d_num, sizeof(int), cudaMemcpyDeviceToHost);
    cudaFree(d_num);
}